// Copyright 2004 The Trustees of Indiana University.
// Copyright 2005 Matthias Troyer.
// Copyright 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//  Authors: Douglas Gregor
//           Andrew Lumsdaine
//           Matthias Troyer
//
//  Jeongnim Kim imported mpi/datatype.h to keep the same interfaces
#ifndef QMCPLUSPLUS_MPI_DATATYPES_H
#define QMCPLUSPLUS_MPI_DATATYPES_H

namespace mpi {

#if defined(HAVE_MPI)
template <typename T>                              
inline MPI_Datatype                                     
get_mpi_datatype(const T&) { return MPI_BYTE;}

#define BOOSTSUB_MPI_DATATYPE(CppType, MPIType)                         \
template<>                                                              \
inline MPI_Datatype                                                     \
get_mpi_datatype< CppType >(const CppType&) { return MPIType; }         

/// INTERNAL ONLY
BOOSTSUB_MPI_DATATYPE(short, MPI_SHORT);

/// INTERNAL ONLY
BOOSTSUB_MPI_DATATYPE(int, MPI_INT);

/// INTERNAL ONLY
BOOSTSUB_MPI_DATATYPE(long, MPI_LONG);

/// INTERNAL ONLY
BOOSTSUB_MPI_DATATYPE(float, MPI_FLOAT);

/// INTERNAL ONLY
BOOSTSUB_MPI_DATATYPE(double, MPI_DOUBLE);
#else
  typedef int MPI_Datatype;
#endif
}

#endif
